package mycrypto

import (
	"errors"
)

func GetFilename(src, pwd string) (name string, err error) {
	mode := GetModeFromFile(src)
	switch mode {
	case ModeCTR:
		name, err = ReadNameFromFile(src, pwd)
		return
	case ModeCFB:
		name, err = CfbReadNameFromFile(src, pwd)
		return
	default:
		err = errors.New("AES Format error")
		return
	}
}

func DecryptoFile(src, dst, pwd string) (err error) {
	mode := GetModeFromFile(src)
	switch mode {
	case ModeCTR:
		err = DecryptoFromFile(src, dst, pwd)
		return
	case ModeCFB:
		err = CfbDecryptoFromFile(src, dst, pwd)
		return
	default:
		err = errors.New("AES Format error")
		return
	}
}
